package mmoon.mmoonstory;

import mmoon.mmoonstory.commands.CommandGM;
import mmoon.mmoonstory.commands.CommandSpeed;
import mmoon.mmoonstory.commands.absorb.CommandAbsorb;
import mmoon.mmoonstory.commands.equip.CommandEquip;
import mmoon.mmoonstory.world.OreGenerator;
import net.minecraft.block.material.EnumPushReaction;
import net.minecraft.block.material.MapColor;
import net.minecraft.block.material.Material;
import net.minecraft.command.CommandBase;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.ai.attributes.IAttribute;
import net.minecraft.entity.ai.attributes.RangedAttribute;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.Item;
import net.minecraft.item.ItemArmor;
import net.minecraft.util.DamageSource;
import net.minecraftforge.common.util.EnumHelper;
import net.minecraftforge.fml.common.IWorldGenerator;

import java.util.ArrayList;

public class MMoonUtils {
    public static final ArrayList<CommandBase> MMOON_COMMANDS = new ArrayList<>();
    public static final ArrayList<IWorldGenerator> MMOON_WORLD_GENERATORS = new ArrayList<>();

    public static final CreativeTabs MMOON_CREATIVE_TAB = new MMoonCreativeTab(MMoonStory.MOD_ID);

    public static final IAttribute MagicPower = new RangedAttribute(null, "mmoonstory.attribute.magic_power", 0, 0,
            20.0).setShouldWatch(false);

    public static final Item.ToolMaterial UNI = EnumHelper.addToolMaterial("uni", Integer.MAX_VALUE, Integer.MAX_VALUE, Float.MAX_VALUE, Float.MAX_VALUE, Integer.MAX_VALUE);
    public static final Item.ToolMaterial OBSIDIAN_T = EnumHelper.addToolMaterial("obsidian", 4, 2670, 14, 4, 6);

    public static final ItemArmor.ArmorMaterial OBSIDIAN_A = EnumHelper.addArmorMaterial("obsidian", "obsidian", 3275,
            new int[]{4, 7, 9, 4}, 6, SoundEvents.ITEM_ARMOR_EQUIP_DIAMOND, 3);

    public static final Material UNBREAKABLE = new Material(MapColor.BLACK) {
        public boolean isSolid() {
            return true;
        }

        public boolean blocksMovement() {
            return false;
        }

        public boolean getCanBurn() {
            return false;
        }

        public boolean isReplaceable() {
            return false;
        }

        public boolean isOpaque() {
            return true;
        }

        public boolean isToolNotRequired() {
            return false;
        }

        public EnumPushReaction getPushReaction() {
            return EnumPushReaction.BLOCK;
        }
    };
    public static final CommandBase ABSORB = new CommandAbsorb();
    public static final CommandBase SPEED = new CommandSpeed();
    public static final CommandBase GM = new CommandGM();
    public static final CommandBase EQUIP = new CommandEquip();

    public static final IWorldGenerator GEN_EMERALD = new OreGenerator(MMoonAll.EMERALD_ORE.getDefaultState(), 4, 10,3);

    public static final DamageSource Scratch = new DamageSource("scratch").setDamageBypassesArmor();
}
